import java.awt.color.ICC_ColorSpace;

public class Test17 {
    public static void main(String[] args) {
        BankAccount b = new BankAccount("张三", 1001, 4003.3f);
        System.out.println(b);
        b.deposit(200f);
        System.out.println(b);
        b.withdraw(5000f);
        b.withdraw(1000f);
        System.out.println(b);
    }
}

class BankAccount {
    private String name;

    private int number;

    private float balance;

    public BankAccount() {
        this(" ", 0, 0.0f);
    }

    public BankAccount(String name, int number, float balance) {
        this.name = name;
        this.number = number;
        this.balance = balance;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public float getBalance() {
        return balance;
    }

    public void setBalance(float balance) {
        this.balance = balance;
    }

    public void deposit(float amount) {
        balance += amount;
    }

    public void withdraw(float amount) {
        if (this.getBalance() < amount) {
            System.out.println("余额不足，无法取款!");
            return;
        }

       balance -= amount;
    }

    @Override
    public String toString() {
        return "姓名: " + this.getName() +
                "\n账号: " + this.getNumber() +
                "\n余额: " + this.getBalance();
    }
}

